Python: Clarify service session ID scoping - #6993
Merged
Merged
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
Python Test Coverage Report •
Python Unit Test Overview
|
||||||||||||||||||||||||||||||
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves user guidance around service_session_id by clarifying that it may represent a provider-issued, service-side continuation handle and by adding multi-user/tenant safety notes to the OpenAI sample.
Changes:
- Add hosted multi-user guidance in the OpenAI session continuation sample to discourage unscoped client round-tripping of
service_session_id. - Refine core session docstrings to better describe what
service_session_idrepresents and how it should be treated.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| python/samples/02-agents/providers/openai/client_with_session.py | Adds cautionary guidance for hosted multi-user apps when persisting/round-tripping service_session_id. |
| python/packages/core/agent_framework/_sessions.py | Updates SessionContext/AgentSession docstrings to clarify semantics of service_session_id. |
TaoChenOSU
approved these changes
Jul 8, 2026
giles17
approved these changes
Jul 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation & Context
Clarifies user-facing guidance around
AgentSession.service_session_idwhen service-managed history is used. The current docs describe it as a lightweight state field, but do not make the OpenAI API key/project scoping behavior or hosted multi-user responsibility explicit.This helps library users understand that OpenAI
resp_*response IDs andconv_*conversation IDs are scoped to the backing API key/project by default, and that hosted agents using one backing key/project for multiple users should bind stored service-side IDs to authenticated users or tenants before resuming.Description & Review Guide
AgentSessionandSessionContextdocstrings to describeservice_session_idas a service-managed session identifier.service_session_idwith background response continuation tokens.Related Issue
N/A — documentation-only clarification; no linked issue.
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.